<?php
include_once(dirname(__FILE__).'/config.php');
$store = ARC2::getStore($arc_config);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8;charset=utf-8"/>
    <title>Les collections J-T. Desanti</title>
  
    <link href="computeFacets.php" type="application/json" rel="exhibit/data" />

    <script src="http://static.simile.mit.edu/exhibit/api-2.0/exhibit-api.js"
            type="text/javascript"></script>
    <!--
    <script src="http://127.0.0.1:8888/exhibit/api/exhibit-api.js?autoCreate=false"
            type="text/javascript"></script>
    -->

 <style>
       body {
           margin: 1in;
       }
       table.collection {
           border:     1px solid #ddd;
           padding:    0.5em;
       }
       div.name {
           font-weight: bold;
           font-size:   120%;
       }
       .type {
           font-style:  italic;
       }
       .exhibit-tabularView-body td img, .thumb {
           height: 100px;
	   width: auto;
       }

   </style>
    
 </head> 
 <body>
    <h1>Les collections J-T. Desanti</h1>
    <table width="100%">
        <tr valign="top">
            <td ex:role="viewPanel">

              <table ex:role="lens" class="collection">
                  <tr>
                      <td><a ex:if-exists=".thumbnail" ex:href-content=".href"><img ex:src-content=".thumbnail" class="thumb" /></a></td>
                      <td>
                          <div ex:if-exists=".label" ex:content=".label" class="name"></div>
                      </td>
                  </tr>
              </table>
	      
              <div ex:role="view"></div>

            </td>
            <td id="facets" width="25%">
              <div ex:role="facet" ex:facetClass="TextSearch"></div>
              <div ex:role="facet" ex:expression=".type" ex:facetLabel="Type"></div>
		<?
		$q = <<<EOT
PREFIX vocabs: <http://desanti.org/schemas/vocabularies#>
SELECT * WHERE {
  ?c a vocabs:Class .
  ?c rdfs:label ?cLabel .
}
EOT;
		$rs = $store->query($q);
		if(!$store->getErrors()){
			$rows = $rs['result']['rows'];

			foreach($rows as $row){
				echo '<div ex:role="facet" ex:expression=".';
				echo $row['cLabel'];
				echo '" ex:facetLabel="';
				echo rawurldecode($row['cLabel']);
				echo '"></div>';
				echo "\n";
			}
		}
		?>
            </td>
        </tr>
    </table>
 </body>
 </html>
